import groovy.sql.Sql
import java.sql.SQLException

public execute(o) {
    return new mc(o)
}

class mc {
    def mypara
    def emptyList = []
    def itemlist = []
    def selectedLog = null
    def lbselectrow = null

    public mc(f) {
        this.mypara = f;
    }

    def selectReimbursementSummary() {
        def conn = null
        try {
            emptyList = []
            conn = Sql.newInstance(mypara.hqcon(1))
            def query = """
            SELECT EmployeeName, ZQBS, JYF, JTJF, ZZDF, BGJF, FLJF, Total 
            FROM ReimbursementSummary
            ORDER BY EmployeeName ASC
        """
            conn.eachRow(query) { row ->
                def t = [
                        name: row.EmployeeName,
                        zpbs: row.ZQBS,
                        jyf: row.JYF,
                        jtjf: row.JTJF,
                        zzdf: row.ZZDF,
                        bgjf: row.BGJF,
                        fljf: row.FLJF,
                        total: row.Total
                ]
                emptyList.add(t)
            }
            mypara.msg("查询成功")
            println(11111)
            return emptyList
        } catch (SQLException e) {
            e.printStackTrace()
            println("SQL 错误: ${e.message}")
        } catch (Exception e) {
            e.printStackTrace()
            println("发生错误: ${e.message}")
        } finally {
            if (conn != null) {
                conn.close()
            }
        }
    }
}